<%@page import="com.kaishengit.entity.CarItem"%>
<%@page import="com.kaishengit.entity.Prod"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'shopCar.jsp' starting page</title>

  </head>
  
  <body>
  	<h3>我的购物车</h3>
  	<a href="home.jsp">继续购物</a>
  	<table border="1" width="50%">
  		<tr>
  			<th>商品名称</th>
  			<th>单价</th>
  			<th>数量</th>
  			<th>总价</th>
  			<th>操作</th>
  		</tr>
  		<% 
  		List<CarItem> list = (List<CarItem>)session.getAttribute("shopCar");
  		float total = 0f;
  		for(CarItem item : list){
  			total+=item.getPrice()*item.getNum();
  		%>
  		<tr>
  			<td><%=item.getProd().getProdName() %></td>
  			<td><%=item.getProd().getPrice() %></td>
  			<td><%=item.getNum() %></td>
  			<td><%=item.getPrice() %></td>
  			<td><a href="#">删除</a></td>
  		</tr>
  		<%};%>
  		<tr>
	  		<td colspan="5">总计	:<%=total %></td>
  		</tr>
  		
  	</table>
  </body>
</html>
